package com.wu.zr

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.wkq.lib_base.adapter.KtAdapter
import com.wu.common.base.adapter.DataBindingViewHolder
import com.wu.zr.databinding.ItemZrBgBinding


/**
 * @author wkq
 *
 * @date 2021年08月17日 13:43
 *
 *@des
 *
 */

class ZrBgAdapter(mContext: Context) : KtAdapter<String>(mContext) {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        var viewDatabinding= DataBindingUtil.inflate<ItemZrBgBinding>(LayoutInflater.from(mContext), R.layout.item_zr_bg,parent,false)

        var viewHolder= DataBindingViewHolder(viewDatabinding.root)
        viewHolder.binding=viewDatabinding
        return viewHolder
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {

        var viewHolder=holder as DataBindingViewHolder
        var binding=viewHolder.binding as ItemZrBgBinding
        Glide.with(mContext).load(getItem(position%3)).into(binding.iv)

    }

    override fun getItemCount(): Int {
        return Int.MAX_VALUE
    }


}